﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Delay="clr-namespace:Delay" xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:Unsupported="clr-namespace:Microsoft.Unsupported" xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7" xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" xmlns:VSM="clr-namespace:JustinAngel.Neurons.Framework" xmlns:controlsPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls" xmlns:Neurons="clr-namespace:JustinAngel.Neurons" x:Class="JustinAngel.Neurons.MainPage"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800" 
    SupportedOrientations="Portrait"  Orientation="Portrait"
    VSM:VSM.StateName="{Binding CurrentStateName}"
    shell:SystemTray.IsVisible="True" d:DataContext="{d:DesignData /SampleData/MainPageViewModelSampleData.xaml}">

    <!--<phone:PhoneApplicationPage.DataContext>
        <Binding Path="MainPageViewModel" Source="{StaticResource ViewModelLocator}"/>
    </phone:PhoneApplicationPage.DataContext>-->

    <!--Panorama-based applications should not show an ApplicationBar-->

    <phone:PhoneApplicationPage.FontFamily>
        <StaticResource ResourceKey="PhoneFontFamilyNormal"/>
    </phone:PhoneApplicationPage.FontFamily>
    <phone:PhoneApplicationPage.FontSize>
        <StaticResource ResourceKey="PhoneFontSizeNormal"/>
    </phone:PhoneApplicationPage.FontSize>
    <phone:PhoneApplicationPage.Foreground>
        <StaticResource ResourceKey="PhoneForegroundBrush"/>
    </phone:PhoneApplicationPage.Foreground>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="LoadingStates">
                <VisualState x:Name="IsLoading">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="loadingProgressBar">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(ProgressBar.IsIndeterminate)" Storyboard.TargetName="loadingProgressBar">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <System:Boolean>True</System:Boolean>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="loadingProgressBar" d:IsOptimized="True"/>
                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="tedListBox" d:IsOptimized="True"/>
                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rsaList" d:IsOptimized="True"/>
                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="foraList" d:IsOptimized="True"/>
                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="sciencedumpList" d:IsOptimized="True"/>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="mainPanorama">
                        	<DiscreteObjectKeyFrame KeyTime="0">
                        		<DiscreteObjectKeyFrame.Value>
                        			<System:Boolean>False</System:Boolean>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="txtPleaseWait" d:IsOptimized="True"/>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="txtPleaseWait">
                        	<DiscreteObjectKeyFrame KeyTime="0">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Visibility>Visible</Visibility>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="NotIsLoading">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(ProgressBar.IsIndeterminate)" Storyboard.TargetName="loadingProgressBar">
                            <DiscreteObjectKeyFrame KeyTime="0">
                        		<DiscreteObjectKeyFrame.Value>
                        			<System:Boolean>True</System:Boolean>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                            <DiscreteObjectKeyFrame KeyTime="0:0:6">
                                <DiscreteObjectKeyFrame.Value>
                                    <System:Boolean>False</System:Boolean>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="loadingProgressBar">
                            <DiscreteObjectKeyFrame KeyTime="0">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Visibility>Visible</Visibility>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                            <DiscreteObjectKeyFrame KeyTime="0:0:6">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="loadingProgressBar">
                            <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:4" Value="1"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:6" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimation Duration="0:0:1.4" To="1038" Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="titleStackPanel" d:IsOptimized="True"/>
                    	<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="tedListBox">
                    		<EasingDoubleKeyFrame KeyTime="0:0:4" Value="0"/>
                    		<EasingDoubleKeyFrame KeyTime="0:0:6" Value="1"/>
                    	</DoubleAnimationUsingKeyFrames>
                    	<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rsaList">
                    		<EasingDoubleKeyFrame KeyTime="0:0:4" Value="0"/>
                    		<EasingDoubleKeyFrame KeyTime="0:0:6" Value="1"/>
                    	</DoubleAnimationUsingKeyFrames>
                    	<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="foraList">
                    		<EasingDoubleKeyFrame KeyTime="0:0:4" Value="0"/>
                    		<EasingDoubleKeyFrame KeyTime="0:0:6" Value="1"/>
                    	</DoubleAnimationUsingKeyFrames>
                    	<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="sciencedumpList">
                    		<EasingDoubleKeyFrame KeyTime="0:0:4" Value="0"/>
                    		<EasingDoubleKeyFrame KeyTime="0:0:6" Value="1"/>
                    	</DoubleAnimationUsingKeyFrames>
                    	<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="mainPanorama">
                    		<DiscreteObjectKeyFrame KeyTime="0:0:6">
                    			<DiscreteObjectKeyFrame.Value>
                    				<System:Boolean>True</System:Boolean>
                    			</DiscreteObjectKeyFrame.Value>
                    		</DiscreteObjectKeyFrame>
                    	</ObjectAnimationUsingKeyFrames>
                    	<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="txtPleaseWait">
                    		<EasingDoubleKeyFrame KeyTime="0:0:4" Value="1"/>
                    		<EasingDoubleKeyFrame KeyTime="0:0:6" Value="0"/>
                    	</DoubleAnimationUsingKeyFrames>
                    	<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="txtPleaseWait">
                    		<DiscreteObjectKeyFrame KeyTime="0:0:4">
                    			<DiscreteObjectKeyFrame.Value>
                    				<Visibility>Visible</Visibility>
                    			</DiscreteObjectKeyFrame.Value>
                    		</DiscreteObjectKeyFrame>
                    		<DiscreteObjectKeyFrame KeyTime="0:0:6">
                    			<DiscreteObjectKeyFrame.Value>
                    				<Visibility>Collapsed</Visibility>
                    			</DiscreteObjectKeyFrame.Value>
                    		</DiscreteObjectKeyFrame>
                    	</ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <!--Panorama control-->
        <controls:Panorama x:Name="mainPanorama" IsHitTestVisible="False">
            <controls:Panorama.Title>
                <StackPanel x:Name="titleStackPanel" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,23,0,0" Width="1728">
                    <toolkit:ContextMenuService.ContextMenu>
                        <toolkit:ContextMenu IsZoomEnabled="False">
                            <toolkit:MenuItem Command="{Binding SendEmailToDeveloper}" Unsupported:TiltEffect.IsTiltEnabled="True">
                                <toolkit:MenuItem.Header>
                                    <TextBlock TextWrapping="Wrap" Text="Email J@JustinAngel.net with feedback on &quot;Neurons&quot; V1.0" />
                                </toolkit:MenuItem.Header>
                            </toolkit:MenuItem>
                        </toolkit:ContextMenu>
                    </toolkit:ContextMenuService.ContextMenu>
                    <!-- <Image Source="/BackgroundNeuron.png" Stretch="Uniform" Width="126" Height="126" Margin="0,21,0,0" Visibility="Collapsed"/> 
  					 -->
                    <TextBlock Text="Neurons." />
                    <TextBlock Text=" Use yours." FontSize="{StaticResource PhoneFontSizeExtraExtraLarge}" VerticalAlignment="Center" Margin="0,96,0,0" />
                </StackPanel>
            </controls:Panorama.Title>

            <controls:PanoramaItem>
                <controls:PanoramaItem.Header>
                    <TextBlock Text="TED Talks">
            			<toolkit:ContextMenuService.ContextMenu>
            				<toolkit:ContextMenu IsZoomEnabled="False">
            					<toolkit:MenuItem Command="{Binding GoToWebsite}" CommandParameter="http://www.ted.com" Header="go to TED.com" Unsupported:TiltEffect.IsTiltEnabled="True"/>
            					<toolkit:MenuItem Command="{Binding NavigateToSearch}" CommandParameter="TED" Header="search for more videos" Unsupported:TiltEffect.IsTiltEnabled="True"/>
            				</toolkit:ContextMenu>
            			</toolkit:ContextMenuService.ContextMenu>
                    </TextBlock>
                </controls:PanoramaItem.Header>
                <Delay:DeferredLoadListBox x:Name="tedListBox" ItemsSource="{Binding TEDItems}" Style="{StaticResource panoraItemItemsControlStyle}" Opacity="0"/>
            </controls:PanoramaItem>

            <!--Panorama item two-->
            <!--Use 'Orientation="Horizontal"' to enable a panel that lays out horizontally-->
            <controls:PanoramaItem>
                <controls:PanoramaItem.Header>
                    <TextBlock Text="The RSA">
            			<toolkit:ContextMenuService.ContextMenu>
            				<toolkit:ContextMenu IsZoomEnabled="False">
            					<toolkit:MenuItem Command="{Binding GoToWebsite}" CommandParameter="http://www.thersa.org" Header="Go to theRSA.com" Unsupported:TiltEffect.IsTiltEnabled="True"/>
            					<toolkit:MenuItem Command="{Binding NavigateToSearch}" CommandParameter="RSA" Header="search for more videos " Unsupported:TiltEffect.IsTiltEnabled="True"/>
            				</toolkit:ContextMenu>
            			</toolkit:ContextMenuService.ContextMenu>
                    </TextBlock>
                </controls:PanoramaItem.Header>
                <Delay:DeferredLoadListBox x:Name="rsaList" ItemsSource="{Binding RSAItems}" Style="{StaticResource panoraItemItemsControlStyle}" Opacity="0" />
            </controls:PanoramaItem>

            <controls:PanoramaItem>
                <controls:PanoramaItem.Header>
                    <TextBlock Text="FORA.tv">
            			<toolkit:ContextMenuService.ContextMenu>
            				<toolkit:ContextMenu IsZoomEnabled="False">
            					<toolkit:MenuItem Command="{Binding GoToWebsite}" CommandParameter="http://www.fora.tv" Header="Go to FORA.tv" Unsupported:TiltEffect.IsTiltEnabled="True"/>
            					<toolkit:MenuItem Command="{Binding NavigateToSearch}" CommandParameter="FORA.tv" Header="search for more videos" Unsupported:TiltEffect.IsTiltEnabled="True"/>
            				</toolkit:ContextMenu>
            			</toolkit:ContextMenuService.ContextMenu>
                    </TextBlock>
                </controls:PanoramaItem.Header>
                <Delay:DeferredLoadListBox x:Name="foraList" ItemsSource="{Binding FORAtvItems}" Style="{StaticResource panoraItemItemsControlStyle}" Opacity="0" />
            </controls:PanoramaItem>

            <controls:PanoramaItem >
                <controls:PanoramaItem.Header>
                    <TextBlock Text="Science Dump" FontSize="64" Margin="0,5,0,0">
            			 <toolkit:ContextMenuService.ContextMenu>
            				<toolkit:ContextMenu IsZoomEnabled="False">
            					<toolkit:MenuItem Command="{Binding GoToWebsite}" CommandParameter="http://www.sciencedump.com/" Header="Go to ScienceDump.com" Unsupported:TiltEffect.IsTiltEnabled="True"/>
            				</toolkit:ContextMenu>
            			</toolkit:ContextMenuService.ContextMenu>
                    </TextBlock>
                </controls:PanoramaItem.Header>
                <Delay:DeferredLoadListBox x:Name="sciencedumpList" ItemsSource="{Binding ScienceDumpItems}" Style="{StaticResource panoraItemItemsControlStyle}" Opacity="0" />
            </controls:PanoramaItem>


        </controls:Panorama>
        <ProgressBar x:Name="loadingProgressBar" Height="10" Style="{StaticResource PerformanceProgressBar}" VerticalAlignment="Top" Margin="0,311,0,0" IsIndeterminate="True"/>
        <TextBlock x:Name="txtPleaseWait" TextWrapping="Wrap" Text="Please Wait" FontSize="{StaticResource PhoneFontSizeExtraLarge}" VerticalAlignment="Bottom" Margin="52,0,62,234" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" HorizontalAlignment="Center">
        	<TextBlock.RenderTransform>
        		<CompositeTransform Rotation="-45"/>
        	</TextBlock.RenderTransform>
        </TextBlock>
    </Grid>

</phone:PhoneApplicationPage>